<template>
  <h1>1.组件的基本写法</h1>
  <h2>count:{{ count }}</h2>
  <button @click="changeCount">改变count</button>
  <h2>a:{{ a }}</h2>
  <button @click="addA">改变count</button>
</template>

<script lang="ts">
import {defineComponent} from "vue"
export default defineComponent({
  // 在 setup() 函数中返回的对象会暴露给模板和组件实例
  name: "About",
  setup(){

    let count = 0;
    let changeCount = () => {
      console.log("事件触发了");
      count++;
    };

    let a = 666
    let addA = () => {
      console.log("a的值修改了");
    }

    return{
      count,
      changeCount,
      a,
      addA
    }
  }
})
</script>

<style scoped>
</style>